Sends formatted text in a RichTextBox control to a device for printing.
Syntax
object.SelPrint(hdc)
The SelPrint method syntax has these parts:
Part | Description |
object | An object expression that evaluates to an object in the Applies To list. |
hdc | The device context of the device you plan to use to print the contents of the control. |
Remarks
If text is selected in the RichTextBox control, the SelPrint method sends only the selected text to the target device. If no text is selected, the entire contents of the RichTextBox are sent to the target device.
The SelPrint method does not print text from the RichTextBox control. Rather, it sends a copy of formatted text to a device which can print the text. For example, you can send the text to the Printer object using code as follows:
RichTextBox1.SelPrint(Printer.hDC)
Notice that the hDC property of the Printer object is used to specify the device context argument of the SelPrint method.
Note If you use the Printer object as the destination of the text from the RichTextBox control, you must first initialize the device context of the Printer object by printing something like a zero-length string.